package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.exception.BaseException;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.RemoteUserService;
import com.ruoyi.system.api.model.UserInfo;
import net.bytebuddy.asm.Advice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysUseRecord2Mapper;
import com.ruoyi.system.domain.SysUseRecord2;
import com.ruoyi.system.service.ISysUseRecord2Service;

/**
 * 设备使用记录Service业务层处理
 *
 * @author 胡化敏
 * @date 2020-06-22
 */
@Service
public class SysUseRecord2ServiceImpl implements ISysUseRecord2Service {
    @Autowired
    private SysUseRecord2Mapper sysUseRecord2Mapper;
    @Autowired
    private RemoteUserService remoteUserService;


    /**
     * 查询设备使用记录
     *
     * @param recordId 设备使用记录ID
     * @return 设备使用记录
     */
    @Override
    public SysUseRecord2 selectSysUseRecord2ById(Long recordId) {
        return sysUseRecord2Mapper.selectSysUseRecord2ById(recordId);
    }

    /**
     * 查询设备使用记录列表
     *
     * @param sysUseRecord2 设备使用记录
     * @return 设备使用记录
     */
    @Override
    public List<SysUseRecord2> selectSysUseRecord2List(SysUseRecord2 sysUseRecord2) {
        return sysUseRecord2Mapper.selectSysUseRecord2List(sysUseRecord2);
    }

    /**
     * 新增设备使用记录
     *
     * @param sysUseRecord2 设备使用记录
     * @return 结果
     */
    @Override
    public int insertSysUseRecord2(SysUseRecord2 sysUseRecord2) {
        sysUseRecord2.setCreateBy(SecurityUtils.getNickName());
        sysUseRecord2.setCreateTime(DateUtils.getNowDate());
        return sysUseRecord2Mapper.insertSysUseRecord2(sysUseRecord2);
    }

    /**
     * 修改设备使用记录
     *
     * @param sysUseRecord2 设备使用记录
     * @return 结果
     */
    @Override
    public int updateSysUseRecord2(SysUseRecord2 sysUseRecord2) {
        sysUseRecord2.setUpdateTime(DateUtils.getNowDate());
        return sysUseRecord2Mapper.updateSysUseRecord2(sysUseRecord2);
    }

    /**
     * 批量删除设备使用记录
     *
     * @param recordIds 需要删除的设备使用记录ID
     * @return 结果
     */
    @Override
    public int deleteSysUseRecord2ByIds(Long[] recordIds) {
        return sysUseRecord2Mapper.deleteSysUseRecord2ByIds(recordIds);
    }

    /**
     * 删除设备使用记录信息
     *
     * @param recordId 设备使用记录ID
     * @return 结果
     */
    @Override
    public int deleteSysUseRecord2ById(Long recordId) {
        return sysUseRecord2Mapper.deleteSysUseRecord2ById(recordId);
    }
}
